﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SCRUM.Core.DataProviders;
using SCRUM.Core.BusinessObjects;
using System.Collections.Specialized;

namespace SCRUM.Core.DAO
{
    /// <summary>
    /// Static access object for handling BLIs
    /// </summary>
    public static class DAOBli
    {
        /// <summary>
        /// Creates the specified Bli.
        /// </summary>
        /// <param name="bli">The specific Bli.</param>
        /// <param name="userStoryID">Bli is in user story</param>
        /// <returns>Bli with ID</returns>
        public static BLI CreateNewBli(BLI bli, int userStoryID)
        {
            return ProviderFactory.Provider.CreateBli(bli, userStoryID);
        }

        /// <summary>
        /// Updates the specified Bli.
        /// </summary>
        /// <param name="bli">The specific Bli.</param>
        /// <param name="userStoryID">Bli is in project</param>
        public static void UpdateBli(BLI bli, int userStoryID)
        {
            ProviderFactory.Provider.UpdateBli(bli, userStoryID);
        }

        /// <summary>
        /// Deletes the specified bli.
        /// </summary>
        /// <param name="bli">The specific Bli.</param>
        public static void DeleteBli(BLI bli)
        {
            ProviderFactory.Provider.DeleteBli(bli.ID);
        }

        /// <summary>
        /// Deletes the specified bli ID.
        /// </summary>
        /// <param name="bliID">The specific Bli.</param>
        public static void DeleteBli(int bliID)
        {
            ProviderFactory.Provider.DeleteBli(bliID);
        }
        
        /// <summary>
        /// Returns BLI according to its id
        /// </summary>
        /// <returns>BLI</returns>
        public static BLI GetBliByID(int bliID)
        {
            return ProviderFactory.Provider.GetBliByID(bliID);
        }

        /// <summary>
        /// Gets all types of Bli + ID of type
        /// </summary>
        /// <returns>list of Bli types + ID of type</returns>
        public static NameValueCollection GetBliTypes()
        {
            return ProviderFactory.Provider.GetBliTypes();
        }


        /// <summary>
        /// Gets all BLIs for specific user story.
        /// </summary>
        /// <param name="userStoryID">All BLIs in user story with this id</param>
        /// <returns>List with all BLIs of the user story.</returns>
        public static IList<BLI> GetAllBlisForUserStory(int userStoryID)
        {
            return ProviderFactory.Provider.GetAllBlisForUserStory(userStoryID);
        }

        /// <summary>
        /// Gets all BLIs for specific sprint.
        /// </summary>
        /// <param name="sprintID">All BLIs in sprint with this id</param>
        /// <returns>List with all BLIs of the sprint.</returns>
        public static IList<BLI> GetAllBlisForSprint(int sprintID)
        {
            return ProviderFactory.Provider.GetAllBlisForSprint(sprintID);
        }

        /// <summary>
        /// Returns BLI according to task 
        /// </summary>
        /// <param name="task">Task to search BLI for</param>
        /// <returns>BLI</returns>
        public static BLI GetBliByTask(Task task)
        {
            return ProviderFactory.Provider.GetBliByTask(task);
        }

        /// <summary>
        /// Gets all BLIs for specific release.
        /// </summary>
        /// <param name="releaseID">All BLIs in release with this id</param>
        /// <returns>List with all BLIs of the release.</returns>
        public static IList<BLI> GetAllBlisForRelease(int releaseID)
        {
            return ProviderFactory.Provider.GetAllBlisForRelease(releaseID);
        }

        /// <summary>
        /// Gets all BLIs for specific project.
        /// </summary>
        /// <param name="projectID">All BLIs in project with this id</param>
        /// <returns>List with all BLIs of the project.</returns>
        public static IList<BLI> GetAllBlisForProject(int projectID)
        {
            return ProviderFactory.Provider.GetAllBlisForProject(projectID);
        }

        /// <summary>
        /// Gets all BLIs.
        /// </summary>
        /// <returns>List with all BLIs.</returns>
        public static IList<BLI> GetAllBlis()
        {
            return ProviderFactory.Provider.GetAllBlis();
        }

        /// <summary>
        /// Gets the blis.
        /// </summary>
        /// <param name="projectID">The project ID.</param>
        /// <param name="releaseID">The release ID.</param>
        /// <param name="sprintID">The sprint ID.</param>
        /// <param name="userStoryID">The user story ID.</param>
        /// <param name="bliID">The bli ID.</param>
        /// <param name="taskID">The task ID.</param>
        /// <returns></returns>
        public static IList<BLI> GetBlis(int projectID, int releaseID, int sprintID, int userStoryID, int bliID, int taskID, int state, string name)
        {
            return ProviderFactory.Provider.GetBlis(projectID, releaseID, sprintID, userStoryID, bliID, taskID, state, name);
        }
    }
}
